<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
     content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>学生后台管理系统</title>
  <link rel="stylesheet" href="layui/css/layui.css" >
  <script src="layui/layui.js"></script>
</head>
<body>
  <div class="layui-layout-admin">
    <!--头部-->
    <div class="layui-header">
      <div class="layui-logo">学生后台管理系统</div>
      <ul class="layui-nav layui-layout-left">
        <li class="layui-nav-item"><a href="javascript:void(0)"  >控制台</a></li>
        <li class="layui-nav-item"><a href="javascript:;"        >商品管理</a></li>
        <li class="layui-nav-item">
          <a href="javascript:;"        >其他系统</a>
          <dl class="layui-nav-child">
            <dd><a href="javascript:;"        >邮件管理</a></dd>
            <dd><a href="javascript:;"        >消息管理</a></dd>
            <dd><a href="javascript:;"        >授权管理</a></dd>
          </dl>
        </li>
      </ul>
      <ul class="layui-nav layui-layout-right">
        <li class="layui-nav-item">
          <a href=""><img src="" class="layui-nav-img" th:text="${#session.getAttribute('user').uname}"></a>
          <dl class="layui-nav-child">
            <dd><a href="">基本资料</a></dd>
            <dd><a href="userlogout" onclick="return confirm('你确定退出吗？')">退出</a></dd>
          </dl>
        </li>
      </ul>
    </div>
     
    <!--左侧-->
    <div class="layui-side layui-bg-black">
      <div class="layui-side-scroll">
        <ul class="layui-nav layui-nav-tree" lay-filter="hbkNavbar">
          <li class="layui-nav-item layui-nav-itemed">
            <a href="javascript:;"        >系统操作菜单</a>
            <dl class="layui-nav-child">
              <dd ><a href="javascript:;"   data-options="{id:'tab1',url:'stuquery',title:'学生管理'}">学生管理</a></dd>
              <dd><a href="javascript:;" data-options="{id:'tab2',url:'claquery',title:'班级管理'}">班级管理</a></dd>
              <dd><a href="">导航栏</a></dd>
            </dl>
          </li>
          <li class="layui-nav-item ">
            <a href="#">组件</a>
            <dl class="layui-nav-child">
              <dd><a href="">Navbar</a></dd>
              <dd><a href="">Tab</a></dd>
              <dd><a href="">OneLevel</a></dd>
              <dd><a href="">app.js主入口</a></dd>
            </dl>
          </li>
          <li class="layui-nav-item">
            <a href="">表格</a>
          </li>
          <li class="layui-nav-item">
            <a href="">表单</a>
          </li>
        </ul>
      </div>
    </div>
 
    <!--中间主体-->
    <div class="layui-body" id="container">
      <div class="layui-tab" lay-filter="tabs" lay-allowClose="true">
        <ul class="layui-tab-title">
          <li class="layui-this">首页</li>
        </ul>
        <div class="layui-tab-content">
          <div class="layui-tab-item layui-show">首页内容</div>
        </div>
      </div>
    </div>
 
    <!--底部-->
    <div class="layui-footer">
      <center>xmetc版权所有&copy;Tel:13646005784</center>
    </div>
  </div>
<script>
  //JavaScript代码区域
  layui.use('element', function(){
    var element = layui.element;
	var $ = layui.jquery;
    element.on('nav(hbkNavbar)',function(elem){
		console.log(elem.context.dataset.options)
      /*使用DOM操作获取超链接的自定义data属性值*/
	  try{
	  var options = eval('('+elem.context.dataset.options+')');
	  var id = options.id;
      var url = options.url;
      var title = options.title;
	  if($("li[lay-id='"+id+"']").length==0)//判断为id的tab有没有创建
		  element.tabAdd('tabs',{
			title : title,
			content : '<iframe scrolling="auto" frameborder="0" src="'+url+'" style="width:100%;height:500px;"></iframe>',
			id : id
		  });
	  element.tabChange('tabs', id);//选择当前创建的tab显示
	  }catch(e){
	  }
    });
  });
</script>
</body>
</html>